﻿using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Marbles.Core.Logging
{
    public class DebugLogger : LoggerBase, ILogger
    {
        public void Log(string Source, string Title, string Message, EntryType Type)
        {
            Log(Source, Title, Message, Type, DateTime.Now, 0);
        }

        public void Log(string Source, string Title, string Message, EntryType Type, DateTime TimeStamp)
        {
            Log(Source, Title, Message, Type, TimeStamp, 0);
        }

        public void Log(string Source, string Title, string Message, EntryType Type, int EventID)
        {
            Log(Source, Title, Message, Type, DateTime.Now, EventID);
        }

        public void Log(string Source, string Title, string Message, EntryType Type, DateTime TimeStamp, int EventID)
        {
            LogEntry entry = new LogEntry();
            entry.Source = Source;
            entry.Title = Title;
            entry.Message = Message;
            entry.Type = Type;
            entry.TimeStamp = TimeStamp;
            entry.EventID = EventID;
            Log(entry);
        }

        public void Log(LogEntry Entry)
        {
            if (!IsLoggingEnabled()) { return; }

            Debug.WriteLine("Title     : " + Entry.Title);
            Debug.WriteLine("Source    : " + Entry.Source);
            Debug.WriteLine("Message   : " + Entry.Message);
            Debug.WriteLine("Type      : " + Entry.Type.ToString());
            Debug.WriteLine("TimeStamp : " + Entry.TimeStamp.ToString("dd-MM-yyyy HH:mm:ss"));
            Debug.WriteLine("EventID   : " + Entry.EventID.ToString());

        }

    }
}
